package com.ktdaddy.manager;

import com.github.pagehelper.PageInfo;
import com.ktdaddy.utils.PageResult;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: lujianhao
 * @Description: 共有manager
 * @Date: 2021/7/20 5:55 下午
 */
@Component
public class BaseManager {
    //分页展示最终展现
    public PageResult setterPagedGrid(List<?> list, Integer page) {
        PageInfo<?> pageList = new PageInfo<>(list);
        PageResult result = new PageResult();
        result.setPage(page);
        result.setItems(list);
        result.setTotal(pageList.getPages());
        result.setRecords(pageList.getTotal());
        return result;
    }
}
